package com.neulogistics.contrib.procuredcenter.api.application.command;

import com.blackto.lib.mediat.unicast.IRequest;
import com.neulogistics.contrib.procuredcenter.api.application.validator.annotation.InList;
import com.neulogistics.contrib.procuredcenter.domain.model.valueobject.VendorInfo;
import com.neulogistics.infrastructure.common.serviceresult.BaseResponse;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;

@Data
public class CreateGoodsCommand implements IRequest<BaseResponse<String>>, Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 商品名
     */
    @NotBlank
    @Size(max = 20)
    public String goodsName;

    /**
     * 所属二级分类id
     */
    @NotNull
    @Positive
    public Integer setId;

    /**
     * 计量单位
     */
    @NotBlank
    @Size(max = 3)
    public String measureUnit;

    /**
     * 商品原价
     */
    @NotNull
    @Digits(integer = 9, fraction = 2)
    public Double goodsPrice;

    /**
     * 商品折扣：75折:75；88折:88
     */
    @Min(0)
    @Max(100)
    public Integer goodsDiscount;

    /**
     * 商品成本
     */
    @NotNull
    @Digits(integer = 9, fraction = 2)
    public Double goodsCost;

    /**
     * 商品型号
     */
    public String goodsModel;

    /**
     * {供应商id、供应商名称}
     */
    @NotNull
    public VendorInfo vendorInfo;

    /**
     * 商品保质期限
     */
    @NotNull
    @Future
    public Date goodsShelfLife;

    /**
     * 可否退货：0:不可；1:可
     */
    @NotNull
    @InList(values = {0, 1})
    public Integer optReturn;

    /**
     * 可否换货：0:不可；1:可
     */
    @NotNull
    @InList(values = {0, 1})
    public Integer optReplace;

    /**
     * 商品备注信息
     */
    @Size(max = 200)
    public String goodsRemark;

}
